home *** CD-ROM | disk | FTP | other *** search
- /* WW3DTextWraps.psw
- * Fashioned by Ian Wilkinson.
- * Inception was Sun Jul 17 16:32:15 BST 1994.
- *
- * My History:
- */
-
- /*
- * invalidaccess will result if pathforall is executed on an outline
- * created by charpath for a protected font. (See ``pathforall,'' p.462.)
- */
- defineps PSWWW3DTextIsFontProtected( char *theFont; float fontSize; char *theText |
- boolean *isProtected )
- gsave
- 0.2 setflat
- /theFont fontSize selectfont
- newpath
- 0 0 moveto
- (theText) true charpath closepath
- flattenpath
- { pop pop } { pop pop } { 4 {pop} repeat } {}
- { pathforall } stopped isProtected
- grestore
- endps
-
- defineps PSWWW3DTextMetrics( char *theFont; float fontSize; char theText[1] |
- int *nLoops; int *outlineLen )
- 6 dict begin
- /nCntlPts 0 def
- /theOutlineLen 0 def
- /numLoops 0 def
-
- /moveProc { % x y => -
- pop pop
- /nCntlPts nCntlPts 1 add store
- } bind def
- /lineProc { % x y => -
- moveProc
- } bind def
- /closeProc { % - => -
- nCntlPts 3 ge {
- /theOutlineLen theOutlineLen nCntlPts 1 add 2 mul add store
- /numLoops numLoops 1 add store
- } if
- /nCntlPts 0 store
- } bind def
-
- gsave
- 0.2 setflat
- /theFont fontSize selectfont
- newpath
- 0 0 moveto
- (theText) true charpath closepath
- flattenpath
- { moveProc } { lineProc } { 4 {pop} repeat } { closeProc } pathforall
- theOutlineLen numLoops
- nLoops outlineLen
- grestore
- end
- endps
-
- defineps PSWWW3DTextCounters( char *theFont; float fontSize; char *theText; int numCounters |
- int theCounters[numCounters] )
- 14 dict begin
- /currLoop 0 def
- /isInitial? true def
- /needAdditional? true def
- /nCntlPts 0 def
- /x0 0 def
- /y0 0 def
- /x1 0 def
- /y1 0 def
- /x2 0 def
- /y2 0 def
-
- /isccw? { % - => bool
- x2 x0 sub y1 y0 sub mul
- x1 x0 sub y2 y0 sub mul sub
- 0 lt
- } def
- /moveProc { % x y => -
- isInitial? {
- /y1 exch store
- /x1 exch store
- /isInitial? false store
- }{
- pop pop
- } ifelse
- /nCntlPts nCntlPts 1 add store
- } bind def
- /lineProc { % x y => -
- needAdditional? {
- /y2 exch store
- /x2 exch store
- /needAdditional? false store
- }{
- /y0 exch store
- /x0 exch store
- } ifelse
- /nCntlPts nCntlPts 1 add store
- } bind def
- /closeProc { % - => -
- /isInitial? true store
- /needAdditional? true store
- nCntlPts 3 ge {
- isccw? { currLoop } if
- } if
- /nCntlPts 0 store
- /isCounter? false store
- /currLoop currLoop 1 add store
- } bind def
-
- gsave
- 0.2 setflat
- /theFont fontSize selectfont
- newpath
- 0 0 moveto
- (theText) true charpath closepath
- flattenpath
- [
- { moveProc } { lineProc } { 4 {pop} repeat } { closeProc } pathforall
- ] {
- theCounters
- } forall
- grestore
- end
- endps
-
- defineps PSWWW3DTextLoops( char *theFont; float fontSize; char *theText; int numLoops |
- int theLoops[numLoops] )
- 4 dict begin
- /nCntlPts 0 def
-
- /moveProc { % x y => -
- pop pop
- /nCntlPts nCntlPts 1 add store
- } bind def
- /lineProc { % x y => -
- moveProc
- } bind def
- /closeProc { % - => -
- nCntlPts 3 ge {
- nCntlPts 1 add 2 mul
- } if
- /nCntlPts 0 store
- } bind def
-
- gsave
- 0.2 setflat
- /theFont fontSize selectfont
- newpath
- 0 0 moveto
- (theText) true charpath closepath
- flattenpath
- [
- { moveProc } { lineProc } { 4 {pop} repeat } { closeProc } pathforall
- ] {
- theLoops
- } forall
- grestore
- end
- endps
-
- defineps PSWWW3DTextOutline( char *theFont; float fontSize; char *theText; int outlineLen
- | float charPathOutline[outlineLen] )
- 7 dict begin
- /nCntlPts 0 def
- /isInitial? true def
- /initialX 0 def
- /initialY 0 def
-
- /moveProc { % x y => x y
- /nCntlPts nCntlPts 1 add store
- isInitial? {
- 2 copy
- /initialY exch store
- /initialX exch store
- /isInitial? false store
- } if
- } bind def
- /lineProc { % x y => x y
- moveProc
- } bind def
- /closeProc { % - => initialX initialY
- nCntlPts 3 ge {
- initialX initialY
- }{
- nCntlPts 2 mul { pop } repeat
- } ifelse
- /nCntlPts 0 store
- /isInitial? true store
- } bind def
-
- gsave
- 0.2 setflat
- /theFont fontSize selectfont
- newpath
- 0 0 moveto
- (theText) true charpath closepath
- flattenpath
- [
- { moveProc } { lineProc } { 4 {pop} repeat } { closeProc } pathforall
- ] {
- charPathOutline
- } forall
- grestore
- end
- endps
-